#include "i2c2.h"
#include "PCA9557.h"

void PCA9557::pca9557_init()
{
    //设置管教输出方向，
    i2c_write(PCA9557_ADDR1,PCA9557_CONTROL_REG_3,0x00);
    i2c_write(PCA9557_ADDR2,PCA9557_CONTROL_REG_3,0x00);
    //设置管教极性反转 默认为11110000  即如这位是 1 则如管教设置1 则为0
    i2c_write(PCA9557_ADDR1,PCA9557_CONTROL_REG_2,0x00);
    i2c_write(PCA9557_ADDR2,PCA9557_CONTROL_REG_2,0x00);
}

void PCA9557::pca9557_setval(unsigned char oneval,unsigned char twoval)
{
    i2c_write(PCA9557_ADDR1,PCA9557_CONTROL_REG_1,oneval);
    i2c_write(PCA9557_ADDR2,PCA9557_CONTROL_REG_1,twoval);
}

PCA9557::PCA9557(/* args */)
{
    pca9557_init();
}

PCA9557::~PCA9557()
{

}